import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
/**
 * 合作方类型
 */
export const type = {
    1: '客户',
    2: '供应商',
    3: '其他',
    4: '项目经理',
    5: '物流运输',
    6: '工人',
    7: '员工'
}
/**
 * 单据类型
 */
export const slipType = {
    1: '订单收款单',
    2: '采购付款单',
    3: '预收款单',
    4: '其他收款单',
    5: '报销付款单',
    6: '借款付款单',
    7: '借款还款单',
    8: '退款付款单',
    9: '预付款单',
    10: '资金调拨',
    13: '平台付款单',
    14: '请款付款单'
}
/**
 * 核销类型
 */
export const verificationType = { 1: '待核销', 2: '部分核销', 3: '已核销' };
/**
 * 支付方式
 */
export const payType = {
    1: '账户支付',
    2: '现金',
    3: '预收款',
    4: '抵扣借款单',
    5: '预付款支付',
    6: '在线支付'
}
/**
 * 获取url
 */
export const slipUrl = (type) => {
    let url = ''
    switch (Number(type)) {
        case 1:
        case 2:
        case 3:
        case 4:
        case 8:
        case 9:
        case 10:
        case 14:
            url = `/finance/invoices?type=${type}`;
            break;
        case 5:
        case 6:
        case 7:
            url = `/finance/reimbursed-pay?type=${type}`;
            break;
        default:
            break;
    }
    return url;
}

/**
 * 报销单屏蔽数组
 */
export const shieldArr = ['金额', '分类', '费用描述'];
/**
 * 开票状态
 */
export const whetherBilling = {
    1: '否',
    2: '是'
}
export const billingStatus = {
    1: '未开票',
    2: '已开票'
}

/**
 * 支付平台配置
 */
export const payConfig = {
    merchantNo: "JZT",
    platformCode: "ZHONG_JIN"
}
/**
 * 租户参数
 */
export const tenantParams = {
    businessUserId: userStore.userInfo.tenantId,
    businessType: 1
}
/**
 * 账户类型
 */
export const bankType = {
    1: '对私',
    2: '对公'
}
/**
 * 联行号查询地址
 */
export const searchUrl = [
    'https://cnapscode.com/',
    'https://lianhanghao.saaser.cn/',
    'https://www.cwjyz.com.cn/bank/index.html',
]
// 组合支付-账户
export const accountFormInit = {
  totalAmount: "",
  paymentDate: "",
  paymentAccountId: "",
  receivingAccountId: "",
  paymentVoucherList: []
};

//组合支付-现金
export const cashFormInit = {
  totalAmount: "",
  paymentDate: "",
  paymentVoucherList: []
};
//组合支付-预付款
export const advanceRepayFormInit = {
  deductionAmount: "",
  paymentDate: "",
  deductionRecordList: []
};

//组合支付-账户支付+现金+预付款+还款单公共表单校验
export const formRulesInit = {
  paymentDate: [{ required: true, message: "请选择付款日期", trigger: "blur" }],
  paymentVoucherList: [{ required: true, message: "请上传收款凭证", trigger: "blur" }],
  totalAmount: [
    { required: true, message: "请输入付款金额", trigger: "blur" },
    { pattern: /^[0-9]+(\.[0-9]{1,2})?$/, message: "请输入正确的金额", trigger: "blur" }
  ],
  deductionAmount: [
    { required: true, message: "请输入付款金额", trigger: "blur" },
    { pattern: /^[0-9]+(\.[0-9]{1,2})?$/, message: "请输入正确的金额", trigger: "blur" }
  ],
  receivingAccountId: [{ required: true, message: "请选择收款账户", trigger: "blur" }],
  paymentAccountId: [{ required: true, message: "请选择付款账户", trigger: "blur" }]
};

